December 22, 2020

Outline

  • Basics
  • Scalable Complexity via Scrolling
  • Images and Graphics
  • References

Introduction

  • The tutorial for ioslides is here
  • To render the slides to html and also extract the code chunks to a separate file, run from the command-line:
Rscript -e "rmarkdown::render('ioslide_template.Rmd'); knitr::knit('ioslide_template.Rmd', tangle=TRUE)"
  • Shortcuts for different display modes
    • ‘f’: enable fullscreen mode
    • ‘w’: toggle widescreen mode
    • ‘o’: enable overview mode
    • ‘h’: enable code highlight mode
    • ‘p’: show presenter notes

Math Expressions

\[f(k) = {n \choose k} p^{k} (1-p)^{n-k} \tag{1}\] \[\sigma_{M} = \frac{\sigma}{\sqrt(N)} \tag{2}\]

Citations and Bibliographies

  • Citations can be included autmatically by including them in BibTex format in file bibtex.bib and then citing the them in the text with this syntax [@refid1; @refid2]
  • For example, the citation syntax [@Huber2015-ag; @Howard2013-fq] renders to: (Huber et al. 2015; Howard et al. 2013), and the corresponding references will then automatically be included at the end on a slide entitled ‘References’.
  • More citations (Kim et al. 2013; Langmead and Salzberg 2012; Li and Durbin 2009; Li 2013; Liao, Smyth, and Shi 2013; Lawrence et al. 2013)

Outline

  • Basics
  • Scalable Complexity via Scrolling
  • Images and Graphics
  • References

Scrolling within Code Blocks, Tables and Beyond Slide Boundaries

  • Scrolling of code chunks supported by css code after preamble.
z <- "dajfdfkfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
z
z
z
z
z
z
z
z
z
  • Note: the print behavior of data.frames is autmatically paged when including df_print: paged in preamble. In addition, one can set how many rows are shown on each page by assigning the desired number to the rows.print argument in the header of the corresponding code chunk (e.g. below it is set to 75 rows).
x <- cbind(iris, iris[,5:1])
x

Job Submission with sbatch

Print information about queues/partitions available on a cluster.

sinfo 

Compute jobs are submitted with sbatch via a submission script (here script_name.sh).

sbatch script_name.sh

Sample submission script

#!/bin/bash -l

#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem-per-cpu=1G
#SBATCH --time=1-00:15:00 # 1 day and 15 minutes
#SBATCH --mail-user=useremail@address.com
#SBATCH --mail-type=ALL
#SBATCH --job-name="some_test"
#SBATCH -p batch # Choose queue/parition from: intel, batch, highmem, gpu, short

myscript.sh

Interactive session with specific resource requests

srun --x11 --partition=short --mem=2gb --cpus-per-task 4 --ntasks 1 --time 1:00:00 --pty bash -l

DataTables support

library(DT)
datatable(iris)

Font Size

  • Note: the default in ioslides uses larger font sizes where 'smaller: false' is used. You usually have it set to 'smaller: true'
  • With default turned one can also set smaller font sizes on a per slide basis by specifying '{.smaller}' at the end of a slide title
  • To have more fine control over font size use embedded HTML code. Here are some examples:
    • HTML font size 28px
    • HTML font size 18px
    • HTML font size 14px
    • HTML font size 12px

Center Text

  • To vertically center content, use the {.flexbox .vcenter} option after the title of a slide
  • HTML tags can also be used.

Two Column Layout

This can be useful to have a figure on the right and bullets describing it on the left.

  • Bullet 1
  • Bullet 2
  • Bullet 3

Outline

  • Basics
  • Scalable Complexity via Scrolling
  • Images and Graphics
  • References

Images

Drawing



  • Using HTML code to insert image is most flexible

Background Images

  • Bullet 1
  • Bullet 2
  • Bullet 3

Real-time Graphics Code Evaluation

library(dplyr); library(ggplot2); library(reshape2)
iris %>% 
    group_by(Species) %>% 
    summarize_all(mean) %>% 
    reshape2::melt(id.vars=c("Species"), variable.name = "Samples", value.name="Values") %>%
    ggplot(aes(Samples, Values, fill = Species)) + 
    geom_bar(position="dodge", stat="identity")

Outline

  • Basics
  • Scalable Complexity via Scrolling
  • Images and Graphics
  • References

References

Howard, Brian E, Qiwen Hu, Ahmet Can Babaoglu, Manan Chandra, Monica Borghi, Xiaoping Tan, Luyan He, et al. 2013. “High-Throughput RNA Sequencing of Pseudomonas-Infected Arabidopsis Reveals Hidden Transcriptome Complexity and Novel Splice Variants.” PLoS One 8 (10): e74183. https://doi.org/10.1371/journal.pone.0074183.

Huber, Wolfgang, Vincent J Carey, Robert Gentleman, Simon Anders, Marc Carlson, Benilton S Carvalho, Hector Corrada Bravo, et al. 2015. “Orchestrating High-Throughput Genomic Analysis with Bioconductor.” Nat. Methods 12 (2): 115–21. https://doi.org/10.1038/nmeth.3252.

Kim, Daehwan, Geo Pertea, Cole Trapnell, Harold Pimentel, Ryan Kelley, and Steven L Salzberg. 2013. “TopHat2: Accurate Alignment of Transcriptomes in the Presence of Insertions, Deletions and Gene Fusions.” Genome Biol. 14 (4): R36. https://doi.org/10.1186/gb-2013-14-4-r36.

Langmead, Ben, and Steven L Salzberg. 2012. “Fast Gapped-Read Alignment with Bowtie 2.” Nat. Methods 9 (4). Nature Publishing Group: 357–59. https://doi.org/10.1038/nmeth.1923.

Lawrence, Michael, Wolfgang Huber, Hervé Pagès, Patrick Aboyoun, Marc Carlson, Robert Gentleman, Martin T Morgan, and Vincent J Carey. 2013. “Software for Computing and Annotating Genomic Ranges.” PLoS Comput. Biol. 9 (8): e1003118. https://doi.org/10.1371/journal.pcbi.1003118.

Li, H, and R Durbin. 2009. “Fast and Accurate Short Read Alignment with Burrows-Wheeler Transform.” Bioinformatics 25 (14): 1754–60. https://doi.org/10.1093/bioinformatics/btp324.

Li, Heng. 2013. “Aligning Sequence Reads, Clone Sequences and Assembly Contigs with BWA-MEM.” arXiv [Q-bio.GN]. http://arxiv.org/abs/1303.3997.

Liao, Yang, Gordon K Smyth, and Wei Shi. 2013. “The Subread Aligner: Fast, Accurate and Scalable Read Mapping by Seed-and-Vote.” Nucleic Acids Res. 41 (10): e108. https://doi.org/10.1093/nar/gkt214.